{template '_header'}

<div class="page-header">当前位置：<span class="text-primary">行业管理</span></div>

<div class="page-content">
<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="ewei_shopv2" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="platform.industry" />

    <div class="page-toolbar">
        <div class="col-sm-4">
            <div class="pull-left">
                {ifp 'platform.add'}
                <a class="btn btn-primary btn-sm" href="{php echo webUrl('platform/industry/post')}"><i class="fa fa-plus"></i> 添加行业</a>
                {/if}
            </div>
            <div class="input-group-btn">
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
                {ifp 'platform.industry.delete'}
                <button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('platform/industry/mdcatedel')}"><i class='fa fa-trash'></i> 删除</button>
                {/if}
            </div>
        </div>

        <div class="col-sm-4 pull-right">

            <div class="input-group">
                <div class="input-group-select">
                    <select name='status' class='form-control  input-sm select-md' style="width:100px;"  >
                        <option value="0" {if empty($status)} selected  {/if}>状态</option>
                        <option value="1" {if $status==1} selected  {/if}>显示</option>
                        <option value="2" {if $status==2} selected  {/if} >不显示</option>
                    </select>
                </div>
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键字"/>
                <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>
{if count($list)>0}

<table class="table table-hover table-responsive">
    <thead class="navbar-inner" >
    <tr>
        <th style="width:25px;"><input type='checkbox' /></th>
        <th style='width:110px;'>门店行业名称</th>
        <th style='width:110px;'>所属平台</th>
        <th style='width:80px;'>logo</th>
        <!--<th style='width:80px;'>行业服务商</th>-->
        <th style='width:70px;'>状态</th>
        <th style='width:200px;'>操作</th>
    </tr>
    </thead>
    <tbody>
    {loop $list $row}
    <tr>

        <td>
            <input type='checkbox'   value="{$row['id']}"/>
        </td>

        <td >
            <span>{$row['name']}</span>
        </td>

        <td >
            <span>{$row['pname']}</span>
        </td>

        <td >
            <img src="{php echo tomedia($row['thumb'])}" style="width:70px;">
        </td>

        <!--<td >-->
            <!--<img src="{php echo tomedia($row['avatar'])}" style="width:70px;">-->
        <!--</td>-->

        <td>
            <span class='label {if $row['status']==1}label-success{else}label-default{/if}'
            {ifp 'platform.industry.status'}
            data-toggle='ajaxSwitch'
            data-switch-value='{$row['status']}'
            data-switch-value0='0|不显示|label label-default|{php echo webUrl('platform/industry/status',array('status'=>1,'id'=>$row['id']))}'
            data-switch-value1='1|显示|label label-success|{php echo webUrl('platform/industry/status',array('status'=>0,'id'=>$row['id']))}'
            {/if}
            >
            {if $row['status']==1}显示{else}不显示{/if}</span>
        </td>
        <td  style="overflow:visible;">
            {ifp 'platform.industry.edit'}
            <div class="btn-group btn-group-sm">
                {ifp 'platform.industry.bonus'}
                <a href="{php echo webUrl('platform/industry/bonus', array('id'=>$row['id']))}" class="btn btn-default btn-sm"><i class="fa fa-edit"></i>分红设置</a>
                {/if}

                <a class="btn btn-default dropdown-toggle" href="{php echo webUrl('platform/industry/post', array('id'=>$row['id']))}"><i class="fa fa-edit"></i>编辑</a>
                {ifp 'platform.industry.delete'}
                <a data-toggle='ajaxRemove' href="{php echo webUrl('platform/industry/mdcatedel', array('id'=>$row['id']))}" class="btn btn-default btn-sm" data-confirm="确认要删除行业吗?"><i class="fa fa-trash"></i> 删除</a>
                {/if}
            </div>
            {/if}
        </td>
    </tr>
    {/loop}
    </tbody>
</table>
{$pager}

    {else}
    <div class="panel panel-default">
        <div class="panel-body empty-data">未查询到相关数据</div>
    </div>
    {/if}
</div>
<script language="javascript">

    require(['bootstrap'],function(){
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left',
            title : $(this).data('title'),
            html: 'true',
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
            var _this = this;
            $(this).popover("show");
            $(this).siblings(".popover").on("mouseleave", function () {
                $(_this).popover('hide');
            });
        }).on("mouseleave", function () {
            var _this = this;
            setTimeout(function () {
                if (!$(".popover:hover").length) {
                    $(_this).popover("hide")
                }
            }, 100);
        });
    });

    function displayUrl(lurl) {
        require(['jquery', 'util'], function($, u) {
            var content = '<p class="form-control-static" style="word-break:break-all">菜单使用链接(需要oAuth): <br>' + lurl + '</p>';
            var footer =
                    '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>' +
                    '<button type="button" class="btn btn-primary">复制菜单链接</button>' ;
            var diaobj = u.dialog('查看URL', content, footer);
            diaobj.find('.btn-default').click(function() {
                diaobj.modal('hide');
            });
            diaobj.on('shown.bs.modal', function(){
                u.clip(diaobj.find('.btn-primary')[0], lurl);
            });
            diaobj.modal('show');
        });
    }

</script>
{template '_footer'}